<?php
namespace Api\Controller;
use Api\Controller\CommonController;
class IndexController extends CommonController {
    public function index(){
		
    }
    
    public function slideImg(){
		empty($_POST['type'])?$this->_returnJson(array("result"=>0,"info"=>"missing parameter","code"=>"123")):$type=intval(I("post.type"));
		
		
        $host=getHost();
        $where=array("isOn"=>1,'type'=>$_POST['type']);
        $order=array("index"=>"asc");
        $field="imgID,title,jumpType,jumpUrl,goodsID,shopID,shopType,moduleID,imgPath,thumb,index";
        
    	$list=D("SlideImg")->getSlideImgList($where,$order,$field);
		
    	foreach ($list as $key=>$a){
    		$list[$key]['imgPath']=C('IMG_DOMAIN').$a['imgPath'];
			if($a['jumpType']=='material'){
				$list[$key]['jumpUrl'] = C('SERVER_DOMAIN').'/CNEPShop/Material/view.html?id=' . $a['materialID'];
			}
    	}
    	
    	$this->_returnJson(array("result"=>1,"list"=>$list));
    }
    
    
}